package com.example.testrxjava.adapter;

import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.testrxjava.R;
import com.example.testrxjava.fragment.system.KnowLedgeBean;

import java.util.List;

/**
 * 项目名称：TestRxjava
 *
 * @Author 郭迎辉
 * Create by 9:25 on 2019/4/19.
 * Describe: 知识体系适配器
 *
 */
public class KnowLedgeTreeAdapter extends BaseQuickAdapter<KnowLedgeBean.DataBean, BaseViewHolder> {
    public KnowLedgeTreeAdapter(int layoutResId, @Nullable List<KnowLedgeBean.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, KnowLedgeBean.DataBean item) {
        if (item==null){
            return;
        }
        String secondSystemText = "";
        for(KnowLedgeBean.DataBean.ChildrenBean secondSystem: item.getChildren() ){
            secondSystemText += secondSystem.getName()+"   ";
        }
        helper.setText(R.id.systemItemFirstTv,item.getName())
                .setText(R.id.systemItemSecondTv,secondSystemText);
    }


}
